# selection.Selection.[Symbol.iterator]

- **Module:** selection.Selection
- **Package:** @libtmux/libtmux
- **Language:** TypeScript
- **Kind:** method
- **Source:** https://github.com/libtmux/libtmux-ts/blob/2cb93308200da38a26b59876618116850f110607/packages/libtmux/src/selection.ts#L356
- **Page:** https://libtmux.org/reference/ts/selection-selection-[symbol-iterator]/

```
selection.Selection.[Symbol.iterator]() -> IterableIterator<Model>
```

Iterate in tmux's own order.

Each call returns a fresh iterator, so a selection can be walked more than
once: spread it and then loop it, and the second pass is not empty. This is
what `for...of`, spread and destructuring all go through.

## Example

```ts
for (const window of snapshot.windows) window.name;
[...snapshot.windows].length === snapshot.windows.length;
```
